<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 练习1
        let fn1 = function([a, b]){
            // console.log(arguments)
            console.log(a, b);
        }
        console.log(fn1.length);//1 因为[a, b]只能说是一个参数
        
        
        // fn1([1, 2])//1,2
        // fn1([1])//1,undefined
        
        // fn1([['a','b'], 2])//['a','b'], 2
        
        // fn1(1, 2)//报错
        // fn1({a:1,b:2});//报错
        fn1([{a:1,b:2}]);//{a: 1, b: 2} undefined

        
        // 练习2
        // let fn2 = function([a = 99, b = 100]){
        //     console.log(a, b)
        // }
        
        // fn2([1, 2])//1,2
        // fn2([1])//1,100
        // fn2([['a','b'], 2])//['a','b'], 2
        
        // // 练习3
        // let fn3 = function({a, b=4}){
        //     console.log(a, b)
        // }
        
        // fn3([1, 2]) //undefined,4
        // fn3({a: 1, b: 2}) //1,2
        // fn3({b: 55, a: 22}) // 22,55
        // fn3({d:100, e:200})//undefined,4
        // fn3({c:99,d:99,a:50,b:'hello'})//a:50,b:'hello'
    </script>
</body>
</html>